import { NextFunction, Request, Response } from 'express';
import { getErr } from './getSendResult'
export default (err: Error, req: Request, res: Response, next: NextFunction) => {
  if (err) {
    const error = {
      code: 500,
      msg: err instanceof Error ? err.message : err
    }
    res.status(500).send(getErr());
  } else {
    next();
  }
}